Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tests): fix reconfiguration completion detection #12117

Closed
wants to merge 1 commit into from

Conversation

hanshuebner
Copy link
Contributor

@hanshuebner hanshuebner commented Nov 29, 2023

Summary

Previously, the transaction ID that was reported was from before the admin API request was finished. Also, invalidations could sometimes be delayed long enough to cause a conditional request to be executed even though a subsystem has not been rebuilt.

This change fixes the behavior in multiple ways:

  • Invalidations are invoked from the DAO:post_crud_event in a synchronous fashion rather than having event handlers invalidate. This ensures that when the admin API request finishes, the cache is invalidated as well.

  • The transaction ID is saved to the nginx context in DAO:post_crud_event and set in the response header in the Kong.admin_header_filter function.

  • The current transaction ID is retrieved by the data plane from the shared cache instead of from Postgres. Previously, every iteration of the rebuild cycle incremented the current transaction ID by one, making debugging more difficult.

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

KAG-3195

@hanshuebner hanshuebner force-pushed the fix/reconfiguration-completion-detection branch 2 times, most recently from 8538677 to 2cee947 Compare November 30, 2023 06:55
@hanshuebner hanshuebner force-pushed the fix/reconfiguration-completion-detection branch from 5c190ea to 2f8eb74 Compare November 30, 2023 14:23
@hanshuebner hanshuebner force-pushed the fix/reconfiguration-completion-detection branch from b4a4204 to 622e9e4 Compare December 1, 2023 09:11
@hanshuebner hanshuebner marked this pull request as ready for review December 1, 2023 17:18
@hanshuebner hanshuebner requested review from bungle and flrgh December 1, 2023 18:20
Previously, the transaction ID that was reported was from before the
admin API request was finished.  Also, invalidations could sometimes
be delayed long enough to cause a conditional request to be executed
even though a subsystem has not been rebuilt.

This change fixes the behavior in multiple ways:

 - Invalidations are invoked from the DAO:post_crud_event in a
   synchronous fashion rather than having event handlers invalidate.
   This ensures that when the admin API request finishes, the cache is
   invalidated as well.

 - The transaction ID is saved to the nginx context in
   `DAO:post_crud_event` and set in the response header in the
   `Kong.admin_header_filter` function.

 - The current transaction ID is retrieved by the data plane from the
   shared cache instead of from Postgres.  Previously, every iteration
   of the rebuild cycle incremented the current transaction ID by one,
   making debugging more difficult.
@hanshuebner hanshuebner force-pushed the fix/reconfiguration-completion-detection branch from a5e2e8e to d2d4242 Compare December 1, 2023 18:50
@dndx dndx added the pr/discussion This PR is being debated. Probably just a few details. label Dec 4, 2023
@dndx dndx marked this pull request as draft December 4, 2023 03:48
@dndx
Copy link
Member

dndx commented Dec 4, 2023

Hello @hanshuebner , temporarily converting this to Draft so we can wait for the updated design doc. Let's take a bit more time and make sure to execute it properly. Please also briefly describe the issue encountered with the first design in the updated design doc.

cc @hbagdi , will ping you once the updated design doc is up.

@hanshuebner
Copy link
Contributor Author

@hanshuebner
Copy link
Contributor Author

@hbagdi says that it is too risky to change the invalidation behavior to support testing better. Closing this PR.

@hanshuebner hanshuebner closed this Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants